package com.jhws.core.spring;

import com.jhws.common.Page;

public class PageContext {
	private static ThreadLocal<Page> page = new ThreadLocal<Page>();
	
	
	public static void setPage(Page p){
		page.set(p);
	}
	
	public static Page getPage(boolean forceNotNull){
		Page p =  page.get();
		if(forceNotNull && p == null){
			throw new NullPointerException("分页参数为空，请检查是否传递了分页必须参数：page");
		}
		return p;
	}
	
	public static void removePage(){
		page.remove();
	}
}	
